package com.example.portdemo.view;

import com.example.portdemo.date.api.RetrofitClient;
import com.example.portdemo.date.model.User;
import com.example.portdemo.service.ApiService;


import java.util.List;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

public class ExampleUsage {

    public void fetchUsers() {
        ApiService apiService = RetrofitClient.createService(ApiService.class);
        Call<List<User>> call = apiService.getUsers();
        call.enqueue(new Callback<List<User>>() {
            @Override
            public void onResponse(Call<List<User>> call, Response<List<User>> response) {
                if (response.isSuccessful()) {
                    // Handle the successful response
                    List<User> users = response.body();
                    // Update UI or process the data
                } else {
                    // Handle the error scenario
                }
            }

            @Override
            public void onFailure(Call<List<User>> call, Throwable t) {
                // Handle the error scenario
            }
        });
    }
}
